package com.lqk.springbootminio.config;

import com.lqk.springbootminio.properties.MinioConfigProperties;
import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liqiankun@nnuo.com
 * @date 2023/3/24 10:11
 * @description minio配置文件
 **/
@Slf4j
@Configuration
public class MinioConfig {
    @Autowired
    private MinioConfigProperties properties;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(properties.getEndpoint())
                .credentials(properties.getAccessKey(), properties.getSecretKey())
                .build();
    }

}
